<?php

class CodeIslands_Island_Abstract
{
	protected $_api_service_factory;
	
	public function __construct($api_service_factory)
	{
		$this->_api_service_factory = $api_service_factory;
	}
	
	protected function fetchIsland($island_data, $template_name='ui')
	{
		$reflector = new ReflectionClass(get_class($this));
        $template_path = dirname($reflector->getFileName()) . '/templates/';
        
        $template_engine_service = $this->_api_service_factory->getService('TemplateEngine');
       
		return $template_engine_service->fetch($island_data, "$template_path/$template_name.tpl");
	}
}